package org.yx.service.sres.view_group_resource_detail;

import org.dbist.dml.Query;
import org.yx.exception.BizException;
import org.yx.models.SresDevDef;
import org.yx.utils.BaseService;
import org.yx.utils.FieldMap;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查询资源组下的资源明细
 * 
 * @author zxw
 * @since 2022/04/21
 **/
public class SresViewGroupResourceDetailService extends BaseService {
	public SresViewGroupResourceDetailOut viewGroupResourceDetail(SresViewGroupResourceDetailIn in) throws Exception {
		if (StrUtil.isBlank(in.getGroupCode())) {
			throw new BizException("SYS-0004", FieldMap.of("parameter", "groupCode"));
		}

		SresViewGroupResourceDetailOut out = new SresViewGroupResourceDetailOut();
		Query query = new Query();
		query.addFilter("orgCode", in.getUserOrgCode());
		query.addFilter("groupCode", in.getGroupCode());

		out.setResList(selectListBySqlPath("select_group_with_resource.sql", query, SresDevDef.class));

		return out;
	}
}